/**
 * 
 */
package com.gr.notes.core.push;

import org.apache.wicket.Component;

/**
 * @author Graham Rhodes 20 Feb 2011 13:09:05
 */
public interface IPushService {

    void addPushChannelDisconnectedListener(IPushChannelDisconnectedListener listener);

    <EventType> IPushChannel<EventType> installPushChannel(final Component component, final IPushEventHandler<EventType> pushEventHandler);

    /**
     * Determines if the client is still connected, otherwise clears all queued events.
     */
    boolean isConnected(final IPushChannel<?> pushChannel);

    /**
     * Queues the given event for later processing by the associated {@link AbstractPushEventHandler}.<br>
     * The method does nothing in case the client is no longer connected.
     */
    <EventType> void publish(final IPushChannel<EventType> pushChannel, final EventType event);

    void removePushChannelDisconnectedListener(IPushChannelDisconnectedListener listener);

    void uninstallPushChannel(final Component component, final IPushChannel<?> pushChannel);
}
